package web.member;

import com.google.gson.Gson;
import entity.MemberBean;
import services.MemberServices;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/getMemberId")
public class GetMemberId extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("application/json");
        int member_id = Integer.parseInt(req.getParameter("member_id"));
        MemberBean member = new MemberServices().getMemberId(member_id);
        Gson gson = new Gson();
        String json = gson.toJson(member);
        resp.getWriter().println(json);
    }
}
